Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make improvements to org table #10679

Conversation

TheSussex
Copy link
Collaborator

@TheSussex TheSussex commented Aug 12, 2024

What

  • added responsiveness to the table by making it horizontally scrollable.
  • added custom visibility option, so users can choose which column they want to see/not see on the table.
  • updated templates/web/common/site_layout.tt.html file to include a link only visible to admins and moderators in the homepage menu, this link leads to the organization table page.
  • updated /cgi/display_org_table.pl file to persist search queries values in the form after submission.
  • replaced creator field with creator_email
  • created a script that populates the creator email for existing orgs

Screenshot

Screenshot 2024-08-12 at 9 33 25 AM Screenshot 2024-08-12 at 9 33 41 AM

@TheSussex TheSussex requested a review from a team as a code owner August 12, 2024 08:43
@github-actions github-actions bot added Template::Toolkit The templating toolkit used by product opener. The starting point for HTML/JS/CSS fixes. 🌐 Translations Site layout labels Aug 12, 2024
@codecov-commenter
Copy link

codecov-commenter commented Aug 12, 2024

Codecov Report

Attention: Patch coverage is 16.66667% with 5 lines in your changes missing coverage. Please review.

Project coverage is 49.22%. Comparing base (dc04d18) to head (6a5459e).
Report is 651 commits behind head on main.

Files with missing lines Patch % Lines
lib/ProductOpener/Orgs.pm 16.66% 3 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10679      +/-   ##
==========================================
- Coverage   49.54%   49.22%   -0.33%     
==========================================
  Files          67       77      +10     
  Lines       20650    22093    +1443     
  Branches     4980     5277     +297     
==========================================
+ Hits        10231    10875     +644     
- Misses       9131     9890     +759     
- Partials     1288     1328      +40     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

SCRIPTS
;

$request_ref->{header} .= <<HEADER
<link rel="stylesheet" href="https://static.openfoodfacts.org/js/datatables.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.3.6/css/buttons.dataTables.min.css">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you create a new version of the datatables.css and so on, which include the buttons? Alternatively, move DataTables to be downloaded from npm and bundled with webpack. We should ensure we use a consistent version, and we want to avoid using CDNs our assets.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how to go about this @hangy

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TheSussex When you look at https://github.com/TheSussex/openfoodfacts-server/blob/9e1dd240ce9a1b4e51e7a3dcd8ac6f03aeaaf57b/html/js/datatables.css#L7-L10, you can see that the datatables we currently publish with some specific settings. If you go to that link, you can select the buttons component to be bundled, too. The simplest version would be to simply download the modified CSS and JS files from the datatables site and then replace the ones currently in git.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did this and it's not showing the column visibility button anymore. Am I supposed to rebuild or what?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did this and it's not showing the column visibility button anymore. Am I supposed to rebuild or what?

Yes, can you try rebuilding, please? Just the frontend (make front_build if you're using docker) should be enough.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This did not work @hangy

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hangy @TheSussex I updated the JS files and included the ordering etc. buttons. They were also loaded with a hardcoded path to static.openfoodfacts.org, that's why they were not picked in a local dev environment.

@github-actions github-actions bot added 🏭 Producers Platform https://wiki.openfoodfacts.org/Platform_for_producers 🏭 Orgs ⭐ top pull request Top pull request. labels Aug 12, 2024
po/common/en.po Outdated Show resolved Hide resolved
@github-actions github-actions bot added the 💥 Merge Conflicts 💥 Merge Conflicts label Aug 27, 2024
Copy link

sonarcloud bot commented Sep 17, 2024

@github-actions github-actions bot removed the 💥 Merge Conflicts 💥 Merge Conflicts label Sep 17, 2024
Copy link
Contributor

@stephanegigandet stephanegigandet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @TheSussex !

@stephanegigandet stephanegigandet merged commit b0cfea1 into openfoodfacts:main Sep 17, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏭 Orgs 🏭 Producers Platform https://wiki.openfoodfacts.org/Platform_for_producers Site layout ⭐ top pull request Top pull request. Template::Toolkit The templating toolkit used by product opener. The starting point for HTML/JS/CSS fixes. 🧪 tests 🌐 Translations
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants